home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 February / EnigmA AMIGA RUN 15 (1997)(G.R. Edizioni)(IT)[!][issue 1997-02][PLANET CD V].iso / enigma / earcd / comm / comm5 / adprotam.lha / adpro / ADPro_TAM next >
Text File  |  1997-01-07  |  7KB  |  232 lines

  1. /* 
  2.  * ADPro Transfer Anim arexx script
  3.  * $VER: ADPro_Transfer_Anim.rexx 0.75 1.7.9
  4.  * by Frank E Lahr © 1997 VTnt
  5.  *
  6.  * This script is a program and should be run from the icon
  7.  * instead of executing from ADPro as a macro/script.
  8.  * Otherwise it might cause crashes. OK?
  9.  * This rexx script will make a transfer anim for use
  10.  * with AWeb's browser. It takes a group of image files
  11.  * and makes them into a single delta file. It will also 
  12.  * make the appropiate tooltypes in its icon from the aid 
  13.  * of "c:ViewT" which was made by Phil Dietz.
  14. */
  15.     
  16. OPTIONS RESULTS
  17.  
  18. NL = '0A'X
  19. SQ = '27'X
  20. DQ = '22'X
  21. TRUE  = 1
  22. FALSE = 0
  23. icon = "env:sys/def_tool.info"        /* Set variable to use this icon           */
  24. iconname = "def_tool"                /* Set var name from previous icon         */
  25. destination = "CLIPS:"                /* Set var path as to where to save the icon */
  26.  
  27. CALL Locate_ADPro
  28.  
  29. Address 'ADPro'
  30.  
  31. ADPRO_TO_FRONT
  32. LFORMAT 'UNIVERSAL'
  33.  
  34. GETFILE '"LOAD FILE" "AWeb-II:storage/aweb-a_tam/mine" "new.01"'
  35. IF RC ~= 0 THEN DO
  36.     say 'goodbye cruel world...'
  37.     EXIT
  38. END
  39. LFNAM = ADPRO_RESULT
  40. LOAD LFnam
  41. IF rc ~= 0 THEN DO
  42.         OKAY1 'Could Not Load' LFnam
  43.         EXIT
  44.      END
  45. ELSE DO                 /* Get X & Y Size's of the image */
  46.     XSIZE
  47.     xsize = ADPRO_RESULT
  48.     YSIZE
  49.     ysize = ADPRO_RESULT
  50.     END
  51.  
  52. CALL getallimages
  53. new_xsize = xsize * wdtotal
  54. CALL makebg
  55. say ' '
  56. say 'The X = ' || xsize ||', Y = '|| ysize ||', Total Frames = '||  wdtotal
  57. say 'The resolution of the transfer anim will be '|| new_xsize ||' by '|| ysize
  58. CALL composite
  59. CALL save
  60. CALL makeicon
  61.  
  62. say ' '
  63. say 'I hope you enjoyed my program :)'
  64. ADDRESS COMMAND 
  65. 'c:Delete RAM:adprolist.temp QUIET'
  66. 'c:Wait 2 SECS'
  67.  
  68. EXIT
  69.  
  70. /* *************************************************************** */
  71. /*                       The sub routines                          */
  72. /* *************************************************************** */
  73.  
  74. Locate_ADPro:
  75.     IF SHOW('P', 'ADPro') THEN
  76.         RETURN
  77.     ELSE
  78.         say 'AdPro not running, trying to start...'
  79.         ADDRESS COMMAND 'run >nil: ADPro:ADPro'
  80.         ADDRESS COMMAND 'c:wait 3 SECS'
  81.         call SHOW('P', 'ADPro')
  82.         IF rc = 5 THEN DO
  83.             say 'Unable to start ADPro'
  84.             EXIT
  85.         END
  86.         ELSE
  87.             RETURN
  88.  
  89. /* *********************************************************** */
  90. /*         Make a list of all the images in the sequence       */
  91. /* *********************************************************** */
  92. getallimages :
  93.  
  94. finddot = lastpos('.',LFnam)                /* Look for the '.' in image filepath   */
  95. IF finddot = "0" THEN DO
  96.     say 'The file you selected is not indexed correctly' 
  97.     EXIT
  98.     END
  99. ELSE
  100.     filelength = length(LFnam)             /* How long is the filepath             */
  101.     dot = lastpos('.', LFnam) -1             /* Find position of '.' in the filepath */
  102.     index = filelength - dot                /* Do the math for the index offset     */
  103.     fileindex = RIGHT(LFnam,index)        /* Define the index from the filepath     */
  104.  
  105.     checkindex = VERIFY(fileindex,'.0123456789')    /* Checks index to see if it's numeric    */
  106.         IF checkindex ~= 0 THEN DO 
  107.         say 'The file you selected is not indexed correctly with numbers' 
  108.         EXIT
  109. END
  110.  
  111. findslash = lastpos('/',LFnam)            /* Look for the '/' in image filepath     */
  112. IF findslash = "0" THEN DO                /* If '/' not there,                */
  113.     findcolon = lastpos(':',LFnam)        /* look for ':'.                    */
  114.     IF findcolon = "0" THEN EXIT
  115.     ELSE
  116.         colon = lastpos(':', LFnam)        /* Find ':' in image filepath              */
  117.         file = filelength - colon        /* Do the math for the file offset     */
  118.         filename = RIGHT(LFnam,file)        /* Define the file from the filepath    */
  119.     END
  120. ELSE
  121. slash = lastpos('/', LFnam)                /* Find position of '/' in the filepath */
  122. file = filelength - slash                /* Do the math for the file offset     */
  123. filename = RIGHT(LFnam,file)                /* Define the file from the filepath    */
  124.  
  125. name = lastpos('.', filename)    -1            /* Find position of '.' in filename    */
  126. justname = LEFT(filename,name)            /* Define just name from filename        */
  127. path = LEFT(LFnam,slash)                    /* Defines the path from the filepath    */ 
  128. directory = path                        /* Sets directory path for requester    */
  129.  
  130. /* next make a temp file of the image and associated indexed files to be called later */
  131.  
  132. ADDRESS COMMAND 'c:LIST 'path||justname||'#? TO RAM:adpro.temp NOHEAD QUICK'
  133. IF rc ~= 0 THEN DO
  134.    RequestNotify 'Error listing image files.'
  135.    EXIT
  136. END
  137.  
  138. /* sort alphabetically */
  139. ADDRESS COMMAND 'c:Sort RAM:adpro.temp TO RAM:adprolist.temp'
  140. ADDRESS COMMAND 'c:Delete RAM:adpro.temp QUIET'
  141.  
  142. /* Count the image files that are in the list */
  143. wdtotal = 0
  144. IF ~OPEN(infile, 'Ram:adprolist.temp', 'Read') THEN DO
  145.    RequestNotify 'Cannot read image files.'
  146. END
  147. ELSE
  148.    DO UNTIL EOF(infile)
  149.        wdtotal = wdtotal + Words(READLN(infile))
  150. END
  151. Close(infile)
  152.  
  153. RETURN
  154.  
  155. /* ************************************************** */
  156. /*   Make a background to composite the images onto   */
  157. /* ************************************************** */
  158.  
  159. makebg :
  160.  
  161. LFORMAT 'BACKDROP'
  162. LOAD "XXX" new_xsize ysize "C"
  163. IF RC ~= 0 THEN DO
  164.         OKAY1 'Could Not Load bg'
  165.         EXIT
  166.      END
  167. return
  168.  
  169. /* ************************************************** */
  170. /*          Now composite all the image files         */
  171. /* ************************************************** */
  172.  
  173. composite :
  174.  
  175. LFORMAT 'UNIVERSAL'
  176. Open(infile, 'Ram:adprolist.temp')                /* Open list of image files    */
  177. say 'loading... please wait'
  178. DO UNTIL EOF(infile)
  179.     imagefile = READLN(infile)                /* Read image file            */
  180.      fullfilepath = path||imagefile            /* Add path to image file    */
  181.     LOAD fullfilepath "0" "0" "100" "0" "0" "0"    /* Load image file into Adpro */
  182.         If rc ~= 0 THEN
  183.         LEAVE
  184.     OPERATOR "ROLL" "LEFT" xsize
  185.     END
  186. Close(infile)                                /* Close list of image files    */
  187.  
  188. return
  189.  
  190. /* ************************************************** */
  191. /*       Now save the completed image file out        */
  192. /* ************************************************** */
  193.  
  194. save :
  195.  
  196. SFORMAT 'IFF'
  197. GETFILE 'SAVE-FILE' 'AWeb-II:images' 'def_transferanim'
  198. IF RC ~= 0 THEN  DO
  199.     ADDRESS COMMAND 'c:Delete RAM:adprolist.temp QUIET'
  200.     say 'goodbye...'
  201.     EXIT
  202. END
  203. SFNAM = ADPRO_RESULT
  204. SAVE SFnam Raw
  205. IF RC ~= 0 THEN DO
  206.         OKAY1 'Could Not Save' SFnam
  207.         EXIT
  208.     END
  209. return
  210.  
  211. /* *********************************************************** */
  212. /*    Make an icon with appropiate tooltypes with "c:viewt"    */
  213. /* *********************************************************** */
  214.  
  215. makeicon :
  216.  
  217. say 'making the icon...'
  218. ADDRESS COMMAND 
  219. 'c:copy 'icon' TO 'destination
  220. 'c:viewt 'destination||iconname' add "SIZE='xsize','ysize'"'
  221. 'c:viewt 'destination||iconname' add "FIRST=0,0"'
  222. 'c:viewt 'destination||iconname' add "FRAMES='wdtotal'"'
  223. 'c:viewt 'destination||iconname' add "DELTA='xsize',0"'
  224. 'c:viewt 'destination||iconname' add "REST=0,0"'
  225.  
  226. 'c:copy 'destination||iconname'.info TO 'SFnam'.info'
  227. 'c:delete 'destination||iconname'.info QUIET'
  228.  
  229. return
  230.  
  231.  
  232.